<?php
namespace app\admin\controller;

use app\common\controller\AdminBase;
use think\Cache;
use think\Db;
use think\facade\Config;
use think\facade\Env;

/**
 * SEO设置
 * Class System
 * @package app\admin\controller
 */
class Seo extends AdminBase
{
    public function initialize()
    {
        parent::initialize();
    }

    /**
     * 站点配置
     */
    public function index()
    {
        $seo_config = Config::pull("seo");
        return $this->fetch('index', ['seo' => $seo_config]);
    }

    /**
     * 更新配置
     */
    public function updateConfig()
    {
        if ($this->request->isPost()) {
            $seo_config                = $this->request->post('seo_config/a');
            $fielPath = Env::get('app_path') . "config/seo.php";
            arr2file($fielPath,$seo_config);
            $this->success('提交成功');

        }
    }
}